#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<iterator>
using namespace std;
bool LessThan4(int n){return n<4;}
int main()
{
	int a[5] = {1,2,3,2,5};
	int b[6] = {1,2,5,2,5,6};
	int c[6] = {0,0,0,0,0,0};
	ostream_iterator<int>oit(cout,",");
	remove_if(b,b+6,LessThan4);
	cout<<"1) ";copy(b,b+6,oit);cout<<endl;
	int * p = remove_copy(a,a+5,c,2);
	cout<<"2) "<<p - c<<endl;
	cout<<"3) ";copy(c,c+6,oit);cout<<endl;
	cout<<"4) ";copy(a,a+5,oit);cout<<endl;
	
	memset(c,0,sizeof(c));
	remove_copy_if(a,a+5,c,LessThan4);
	cout<<"5) ";copy(c,c+6,oit);cout<<endl;
	int d[7] = {1,2,2,2,3,3,4};
	vector<int>v;
	v.insert(v.begin(),d,d+7);
	unique(d,d+7);
	cout<<"6) ";copy(d,d+7,oit);cout<<endl;
	memset(d,0,sizeof(d));
	unique_copy(v.begin(),v.end(),d);
	cout<<"7) ";copy(d,d+7,oit);
	return 0;
}